package org.springcloud.wisdom.springcloud_03_freshman.admin.service;

import org.springcloud.wisdom.springcloud_03_freshman.admin.dao.AdminDeptDao;
import org.springcloud.wisdom.springcloud_03_freshman.student.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminDeptService {
    @Autowired
    AdminDeptDao adminDeptDao;
    public boolean insertDept(Dept dept){
        if (dept.getDeptname() ==null){
            return false;
        }
        return adminDeptDao.addDept(dept)>0;
    }

    public  boolean updateDept(Dept dept){
        if (dept.getDeptname()==null){
            return false;
        }
        return adminDeptDao.updateDept(dept)>0;
    }

    public  boolean deleteDept(Integer deptid){
        if (deptid <0 || deptid== null){
            return false;
        }
        return adminDeptDao.deleteDept(deptid)>0;
    }
}
